package com.scuec.groupfive.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.scuec.groupfive.entity.UserInfo;
import com.scuec.groupfive.mapper.UserMapper_zm;
import com.scuec.groupfive.service.UserService_zm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl_zm implements UserService_zm {

    @Autowired
    private UserMapper_zm userMapper;

    @Override
    public List<UserInfo> getUserList() {
        return userMapper.selectUserListWithKeyword(null);
    }

    @Override
    public UserInfo getUserById(Integer id) {
        return userMapper.selectUserById(id);
    }

    @Override
    public PageInfo<UserInfo> getUserPages(Integer pageNum, Integer pageSize, String keyword) {
        PageHelper.startPage(pageNum, pageSize);
        List<UserInfo> userList = userMapper.selectUserListWithKeyword(keyword);
        return new PageInfo<>(userList);
    }
}